//
//  YHSTHomeFoot.m
//  koubei
//
//  Created by 李彦宏 on 2018/5/2.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "YHSTHomeFoot.h"
#import "UITextField+Limit.h"

static int i=7;
@implementation YHSTHomeFoot

//自定义head初始化方法
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUI];
        [self.contentView setBackgroundColor:[UIColor whiteColor]];
    }
    return self;
}
//添加子控件
-(void)setUI{
    //中心view
    UIView *centview=[[UIView alloc]init];
    centview.backgroundColor=[UIColor whiteColor];
    [self.contentView addSubview:centview];
    [centview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(130, 40));
        make.centerX.equalTo(self.contentView);
    }];
    
    //显示天数
    self.ShowDayField=[[UITextField alloc]init];
    self.ShowDayField.borderStyle=UITextBorderStyleRoundedRect;
    self.ShowDayField.placeholder=@"1-365天";
    [self.ShowDayField setLimitTextLength:3];
    
    self.ShowDayField.textAlignment=NSTextAlignmentCenter;
    self.ShowDayField.keyboardType=UIKeyboardTypeNumberPad;
    
    [centview addSubview:self.ShowDayField];
    [self.ShowDayField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(centview.mas_left).offset(5);
        make.top.equalTo(centview.mas_top).offset(7);
        make.size.mas_equalTo(CGSizeMake(80, 30));
    }];
    //查看button
    self.LookBtn=[[UIButton alloc]init];
    [self.LookBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [self.LookBtn setTitle:@"查看" forState:UIControlStateNormal];
    self.LookBtn.layer.cornerRadius=5;
    [self.LookBtn setBackgroundColor:dominantColor];
    [centview addSubview:self.LookBtn];
    [self.LookBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(centview.mas_right).offset(-5);
        make.centerY.equalTo(self.ShowDayField);
        make.top.equalTo(centview.mas_top).offset(7);
        
    }];
    //加
    self.Addbtn=[[UIButton alloc]init];
    [self.Addbtn setTitle:@"下一天" forState:UIControlStateNormal];
    [self.contentView addSubview:self.Addbtn];
    [self.Addbtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [self.Addbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.ShowDayField);
        make.left.equalTo(centview.mas_right).offset(i);
    }];
    //减
    self.ReBtn=[[UIButton alloc]init];
    [self.ReBtn setTitle:@"上一天" forState:UIControlStateNormal];
    [self.contentView addSubview:self.ReBtn];
    [self.ReBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.ReBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.ShowDayField);
        make.right.equalTo(centview.mas_left).offset(-i);
    }];
}




@end
